/**
 * 意见反馈
 * @author Qasim <15750783791@163.com>
 * @version 2016/9/5
 */
document.addEventListener('plusready' , ready , false);
var self = memberInfo = ''
function ready(){
	self = plus.webview.currentWebview();
	memberInfo = plus.storage.getItem('memberInfo');
	memberInfo = $.parseJSON(memberInfo);
	//提交反馈意见
	$('.feedback').on('click' , function(){  
		var content = $('.content').val();
		if(!content.trim()){
			toast('请输入内容');return;
		}
		$.ajax({
			type:"post",
			url:apiRoot +'/Home/Message/feedback/',
			data : {
				user : memberInfo.nickname,
				title : memberInfo.nickname +'在' + new Date().toLocaleString() + '发了一份反馈意见',
				uid : memberInfo.aid,
				body : content ,
				isshow : 0,
				tid : 11
			},
			beforeSend:function(){
				plus.nativeUI.showWaiting('提交中...');
			},
			complete:function(){
				plus.nativeUI.closeWaiting();
			},
			success : function(data){
				if(data > 0){
					$('.content').val('');
					toast('发布成功');
					setTimeout(function(){
						self.close();
					} , 1000);
				}
			},
			error : function(e){
				errorPrompt(e);
			}
		});
	})
}
